feat: Add support for converting KeyPairs into JWKs #33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Feature or Problem
While implementing a Secrets backend for wasmCloud/wasmCloud#2190, we landed on JWTs as the authentication mechanism, and since we have nkeys readily available, it would be nice to use them for signing the JWTs.
However, to make it easier on the platform operators, we are not going to require them to provide a static list of the possible public keys used for signing, but instead provide a JWKS endpoint that'll host a list of the public nkeys used to sign the JWT.
It turns out it's pretty straight forward to convert an nkey into a JWK, which is why I thought it would be nice to add as a feature to this crate for other folks to use as well.
cc @protochron
Related Issues
Release Information
Consumer Impact
Testing
Unit Test(s)
Acceptance or Integration
Manual Verification
I validated locally using
jose-util
from thego-jose
project that the keys generated with the newJsonWebkey
struct, based on a pre-existing nkey, can be used to sign (with seed) and verify (with public key) payloads correctly: